home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / base_alloc.pro < prev    next >
Text File  |  1997-07-08  |  18KB  |  568 lines

  1. ;
  2. ; $Id: base_alloc.pro,v 1.10 1997/03/18 00:07:41 lubos Exp $
  3. ;
  4. ;  WidBase
  5. ;   Base object class definition.
  6. ;
  7. ; Copyright (c) 1993-1997, Research Systems, Inc.  All rights reserved.
  8. ;   Unauthorized reproduction prohibited.
  9. ;
  10. ; MODIFICATION HISTORY
  11. ;       Written by:     Joshua Goldstein,       12/93
  12. ;
  13.  
  14.  
  15. ;
  16. ;  BASE_Icon
  17. ;       Return the base toolbar icon
  18. ;
  19. FUNCTION BASE_Icon
  20.   RETURN, [ $
  21.     [ 0b, 0b, 0b, 0b ], $
  22.     [ 0b, 0b, 0b, 0b ], $
  23.     [ 252b, 255b, 255b, 63b ], $
  24.     [ 252b, 255b, 255b, 63b ], $
  25.     [ 12b, 0b, 0b, 48b ], $
  26.     [ 12b, 0b, 0b, 48b ], $
  27.     [ 12b, 0b, 0b, 48b ], $
  28.     [ 12b, 0b, 0b, 48b ], $
  29.     [ 12b, 0b, 0b, 48b ], $
  30.     [ 12b, 0b, 0b, 48b ], $
  31.     [ 60b, 207b, 243b, 60b ], $
  32.     [ 60b, 207b, 243b, 60b ], $
  33.     [ 12b, 0b, 0b, 48b ], $
  34.     [ 12b, 0b, 0b, 48b ], $
  35.     [ 204b, 49b, 239b, 49b ], $
  36.     [ 76b, 74b, 33b, 48b ], $
  37.     [ 204b, 121b, 239b, 48b ], $
  38.     [ 76b, 74b, 40b, 48b ], $
  39.     [ 204b, 73b, 239b, 49b ], $
  40.     [ 12b, 0b, 0b, 48b ], $
  41.     [ 12b, 0b, 0b, 48b ], $
  42.     [ 60b, 207b, 243b, 60b ], $
  43.     [ 60b, 207b, 243b, 60b ], $
  44.     [ 12b, 0b, 0b, 48b ], $
  45.     [ 12b, 0b, 0b, 48b ], $
  46.     [ 12b, 0b, 0b, 48b ], $
  47.     [ 12b, 0b, 0b, 48b ], $
  48.     [ 12b, 0b, 0b, 48b ], $
  49.     [ 252b, 255b, 255b, 63b ], $
  50.     [ 252b, 255b, 255b, 63b ], $
  51.     [ 0b, 0b, 0b, 0b ], $
  52.     [ 0b, 0b, 0b, 0b ]  $
  53.   ]
  54. END
  55.  
  56.  
  57. ;
  58. ;  BASE_Copy
  59. ;       Copy the given base object.  Remember to copy contents (children)
  60. ;   as well.
  61. ;
  62. PRO BASE_Copy, Ptr, Copy
  63.   COMMON WidEd_Comm
  64.  
  65.     Copy    = WIDGET_BASE(GROUP=TopDlg)    ; Make a pointer
  66.     Ptr2Obj, Ptr, Obj, /COPY        ; Copy original pointer contents
  67.  
  68.     Child   = Obj.Children          ; Child list of original
  69.  
  70.     Obj.Children    = 0             ; Clear copy's child list
  71.     Obj.LastChild   = 0
  72.     Obj2Ptr, Obj, Copy              ; Store copy object into pointer
  73.  
  74.     ;   Now copy child list
  75.     ;   Due to the nature of the copy routines, we need to make sure
  76.     ;   NewChild is <UNDEFINED>. (C.f. XXX_Copy)
  77.  
  78.     WHILE Child NE 0 DO BEGIN
  79.  
  80.         GetType, Child, Type        ; Get object class name
  81.         ClearVar, NewChild          ; make NewChild of type <UNDEFINED>
  82.  
  83.         CALL_PROCEDURE, Type+"_Copy", Child, NewChild       ; Make Copy
  84.         AddChild, Copy, NewChild, /NO_UPDATE, /NO_CANCEL
  85.  
  86.         Child   = NextPtr(Child)    ; Get the next child in list
  87.     ENDWHILE
  88. END
  89.  
  90. ;
  91. ;  BASE_Destroy
  92. ;   Release resources associated with the given object.  Recursively
  93. ;   remove children objects as well.
  94. ;
  95. PRO BASE_Destroy, Ptr
  96.     Ptr2Obj, Ptr, Obj                       ; Get the object
  97.     DoList, Obj.Children, "Destroy"         ; Destroy children
  98.  
  99.     ;   Destroy dialog boxes associated with the object. They are
  100.     ;   no longer useable
  101.  
  102.     IF WIDGET_INFO(Obj.Dialog, /VALID) THEN $
  103.         WIDGET_CONTROL, Obj.Dialog, /DESTROY
  104.     IF WIDGET_INFO(Obj.AttrDlg, /VALID) THEN $
  105.         WIDGET_CONTROL, Obj.AttrDlg, /DESTROY
  106.  
  107.     ;   Destroy the pointer
  108.     WIDGET_CONTROL, Ptr, /DESTROY
  109.  
  110.     ;   Object is in local variable and goes away as we return
  111. END
  112.  
  113.  
  114. ;
  115. ;  BASE_BarEvent
  116. ;   Events from the pull down menu don't have a <STRING> type UVALUE to
  117. ;   use.  Thus we have a separate event routine to handle the menu items.
  118. ;
  119. ;   All base menubar events consist of adding child object
  120. ;
  121. PRO BASE_BarEvent, Event
  122.  
  123.   COMMON WidEd_Comm
  124.  
  125.     ;   We will need the pointer for the Object associated with this
  126.     ;   dialog box (the parent for the children we are about to create)
  127.  
  128.     WIDGET_CONTROL, Event.top, GET_UVALUE=Binfo, /NO_COPY
  129.  
  130.     IF Event.Value EQ 'Add.Hide Tool Bar' THEN BEGIN
  131.  
  132.         WIDGET_CONTROL, Binfo.ToolBar, MAP=0
  133.         WIDGET_CONTROL, Binfo.ToolId, SET_VALUE='Show Tool Bar'
  134.         WIDGET_CONTROL, Binfo.ToolId, SET_UVALUE='Add.Show Tool Bar' ; Hack
  135.         SetTag, Binfo.ObjPtr, "TB_Showing", 0
  136.  
  137.     ENDIF ELSE IF Event.Value EQ 'Add.Show Tool Bar' THEN BEGIN
  138.  
  139.         WIDGET_CONTROL, Binfo.ToolBar, MAP=1
  140.         WIDGET_CONTROL, Binfo.ToolId, SET_VALUE='Hide Tool Bar'
  141.         WIDGET_CONTROL, Binfo.ToolId, SET_UVALUE='Add.Hide Tool Bar' ; Hack
  142.         
  143.         SetTag, Binfo.ObjPtr, "TB_Showing", 1
  144.  
  145.     ENDIF ELSE BEGIN
  146.  
  147.         IF STRMID(Event.Value,0,4) EQ "Add." THEN BEGIN
  148.             Idx     = WHERE(STRMID(Event.Value,4,100) EQ AddList.Menu)
  149.             Build   = AddList[Idx].Class
  150.         ENDIF ELSE MESSAGE, 'Unprocessed event: ' + Event.Value
  151.  
  152.         ;   Allocate object and create a dialog box as well
  153.         CALL_PROCEDURE, Build+'_Build', Ptr, Binfo.ObjPtr
  154.  
  155.         ;   Add child to our child list.  Note that Base object
  156.         ;   do not get added to the active dialog box list
  157.         AddChild, Binfo.ObjPtr, Ptr, NO_CANCEL=(Build EQ 'Base')
  158.  
  159.     ENDELSE
  160.  
  161.     ;   Restore dialog box information
  162.     WIDGET_CONTROL, Event.top, SET_UVALUE=Binfo, /NO_COPY
  163. END
  164.  
  165. ;
  166. ;  BASE_Event
  167. ;   Normal event handling routine for a base object
  168. ;
  169. PRO BASE_Event, Event
  170.  
  171.   COMMON WidEd_Comm
  172.  
  173.     WIDGET_CONTROL, Event.Id, GET_UVALUE=Ev                 ; Get Event
  174.     WIDGET_CONTROL, Event.Top, GET_UVALUE=Binfo, /NO_COPY   ; Get Dialog Info
  175.     Ptr2Obj, Binfo.ObjPtr, Obj                              ; Get Object
  176.  
  177.     CASE Ev OF
  178.  
  179.     'Bbs':      BEGIN                               ; Base is a Bulletin Board
  180.         Obj.BaseType        = 0
  181.         WIDGET_CONTROL, Binfo.RowColId, SENSITIVE=0
  182.         END
  183.     'Row':                BEGIN                     ; Base is a row
  184.         Obj.BaseType        = 1
  185.         WIDGET_CONTROL, Binfo.RowColId, SENSITIVE=1
  186.         END
  187.     'Column':        BEGIN                          ; Base is a column
  188.         Obj.BaseType        = 2
  189.         WIDGET_CONTROL, Binfo.RowColId, SENSITIVE=1
  190.         END
  191.  
  192.     ;   user has set some characteristic of the object to a new value
  193.  
  194.     'NROW':         Obj.NRowCol     = Event.Value
  195.     'SPACE':        Obj.Space       = Event.Value
  196.     'XPAD':         Obj.XPad        = Event.Value
  197.     'YPAD':         Obj.YPad        = Event.Value
  198.     'NAME':         Obj.Name        = Event.Value
  199.     'FRAME':        Obj.FrameSize   = Event.Value
  200.     'XSCROLL':      Obj.XScrollSize = Event.Value
  201.     'YSCROLL':      Obj.YScrollSize = Event.Value
  202.  
  203.     ;   User wants to see the 'Additional attributes' dialog
  204.     'ATTR':     BASE_BuildAttr, Event.Top, Binfo.ObjPtr, Obj
  205.  
  206.     ;   Additional Attribute Events
  207.     'XSIZE':        Obj.XSize       = Event.Value
  208.     'YSIZE':        Obj.YSize       = Event.Value
  209.     'XOFFSET':      Obj.XOffset     = Event.Value
  210.     'YOFFSET':      Obj.YOffset     = Event.Value
  211. ;   'EVENT_FUNC':   Obj.EventFunc   = Event.Value
  212.     'EVENT_PROC':   Obj.EventProc   = Event.Value
  213.     'GETFUNC':      Obj.GetFunc     = Event.Value
  214.     'SETPROC':      Obj.SetProc     = Event.Value
  215.     'KILLPROC':     Obj.KillProc    = Event.Value
  216.     'DO_TLB':       Obj.TLBEvents   = 1 - Obj.TLBEvents
  217.     'MAPPED':       Obj.BaseMapped  = 1 - Obj.BaseMapped
  218.  
  219.     'DONE':         BEGIN
  220.                     Obj2Ptr, Obj, Binfo.ObjPtr
  221.                     WIDGET_CONTROL, Event.top, SET_UVALUE=Binfo, /NO_COPY
  222.                     WIDGET_CONTROL, Event.Top, /DESTROY
  223.                     RETURN
  224.                     END
  225.     ELSE:           MESSAGE, 'Unprocessed event: ' + Ev
  226.     ENDCASE
  227.  
  228.     Dirty   = 1     ; We've changed something since the last save
  229.  
  230.     SetNextFocus, Binfo, Event      ; Set next keyboard focus as necessary
  231.     Obj2Ptr, Obj, Binfo.ObjPtr      ; Put object back into pointer
  232.     WIDGET_CONTROL, Event.top, SET_UVALUE=Binfo, /NO_COPY
  233. END
  234.  
  235.  
  236. ;
  237. ;  BASE_Build
  238. ;   Create a dialog for a new/existing base object
  239. ;
  240. PRO BASE_Build, Ptr, ParPtr
  241.  
  242.   COMMON WidEd_Comm
  243.  
  244.     BASE_Alloc, ParPtr, Ptr                 ; Allocate object if necessary
  245.     MgrName = 'WE_BASE' + STRTRIM(Ptr,2)    ; Create dialog box name
  246.     IF XRegistered(MgrName) THEN RETURN     ; See if we already have one
  247.  
  248.     Title= GetId(Ptr) + '(Child of ' + GetId(ParPtr) + ')'
  249.     Ptr2Obj, Ptr, Obj
  250.     Base            = WIDGET_BASE(/COLUMN, TITLE=Title, GROUP_LEADER=TopDlg)
  251.     Foci            = LONARR(8)
  252.  
  253.     ;   Menu bar contents
  254.  
  255.     Menu            = MakeAddMenu()
  256.     Menu[N_ELEMENTS(Menu)-1].flags  = 2
  257.     MenuBarDesc     = [ { CW_PDMENU_S, 3, 'Add' }, $
  258.                         { CW_PDMENU_S, 0, 'Hide Tool Bar' }, $
  259.                         Menu ]
  260.     If Obj.TB_Showing EQ 0 THEN MenuBarDesc[1].name = 'Show Tool Bar'
  261.     MenuBar         = CW_PDMENU(Base, MenuBarDesc, IDS=Ids, /RETURN_FULL_NAME)
  262.     ToolId          = Ids[1]
  263.  
  264.     BuildToolBar, Base, ToolBar
  265.  
  266.     BuildBaseType, Base, Obj, Foci, 0, RowColId, Btns
  267.     Base1   = WIDGET_BASE(Base, /COLUMN, EVENT_PRO='BASE_Event')
  268.     Foci[4] = Field(Base1, "Name:", Obj.Name, 'NAME', SIZE=50, /STRING)
  269.     Foci[5] = Field(Base1, "Frame Size:", Obj.FrameSize, "FRAME", /INT)
  270.     BuildXY, Base, Obj, Foci, 6, /SIZE
  271.     Dummy   = WIDGET_BUTTON(Base, VALUE='More Attributes', $
  272.                 UVALUE='ATTR', EVENT_PRO='BASE_Event')
  273.  
  274.     Dummy   = WIDGET_LABEL(Base, VALUE=' ')
  275.     Dummy   = WIDGET_BUTTON(Base, VALUE='Done', UVALUE='DONE', $
  276.             EVENT_PRO='BASE_Event')
  277.  
  278.     Obj.Dialog  = Base      ; Save active dialog id in object
  279.  
  280.     DlgInfo = {                 $
  281.         Foci:       Foci,       $
  282.         RowColId:   RowColId,   $
  283.         ToolBar:    ToolBar,    $
  284.         ToolId:     ToolId,     $
  285.         ObjPtr:     Ptr         $
  286.     }
  287.  
  288.     WIDGET_CONTROL, Base, SET_UVALUE=DlgInfo, /NO_COPY  ; save dialog info
  289.     WIDGET_CONTROL, Base, /REALIZE                      ; create dialog
  290.     WIDGET_CONTROL, Btns[Obj.BaseType], /SET_BUTTON     ; Set basetype button
  291.     WIDGET_CONTROL, RowColId, SENSITIVE=(Obj.BaseType NE 0)
  292.  
  293.     WIDGET_CONTROL, ToolBar, MAP=Obj.TB_Showing
  294.  
  295.     ;   Hand off dialog to window manager
  296.     XMANAGER, MgrName, Base, EVENT_HANDLER='BASE_BarEvent', CLEANUP='DEP_Kill'
  297.  
  298.     Obj2Ptr, Obj, Ptr       ; Restore pointer
  299. END
  300.  
  301.  
  302. ;
  303. ;  BASE_Save
  304. ;   Store object information in a file.
  305. ;   Store children as well.  Store the child's type and then the child.
  306. ;   End of list is indicated by the type string of "_END_"
  307. ;
  308. ;   FORMAT:
  309. ;       <Base object>
  310. ;       "ChildType"     E.g. "LABEL", "BUTTON", "DRAW", "TEXT", "BASE", ...
  311. ;       Child
  312. ;       ...
  313. ;       "_END_"
  314. ;
  315. PRO BASE_Save, Unit, Ptr
  316.  
  317.   COMMON WidEd_Comm
  318.  
  319.     ON_IOERROR, BadWrite
  320.  
  321.     Ptr2Obj, Ptr, Obj
  322.  
  323.     WRITEU, Unit, Obj               ; Save Me
  324.  
  325.     Child   = Obj.Children          ; Save my children
  326.     WHILE Child NE 0 DO BEGIN
  327.         GetType, Child, Type
  328.         WRITEU, Unit, Type          ; Save child Type as a <STRING>
  329.         CALL_PROCEDURE, Type + "_Save", Unit, Child ; Save child
  330.         Child   = NextPtr(Child)
  331.     ENDWHILE
  332.  
  333.     WRITEU, Unit, "_END_"           ; Write End-Of-List marker
  334.  
  335.     Obj2Ptr, Obj, Ptr
  336.     RETURN
  337.  
  338.   BadWrite:
  339.     Dirty   = 2
  340. END
  341.  
  342.  
  343. ;
  344. ;  urBase_Restore
  345. ;       There are 3 different base type objects: MAIN, DEP, and BASE
  346. ;   and restoring them has a lot of stuff in common. Thus this common
  347. ;   routine for restoring bases.
  348. ;
  349. PRO urBASE_Restore, Unit, Parent, Ptr, Type
  350.  
  351.     ; Allocated a pointer of the corrent type
  352.     CALL_PROCEDURE, Type+"_Alloc", Parent, Ptr
  353.  
  354.     Ptr2Obj, Ptr, Obj
  355.     READU, Unit, Obj                        ; Read in the object
  356.     Obj.Next        = 0                     ; Clear bogus values
  357.     Obj.Children    = 0
  358.     Obj.LastChild   = 0
  359.     Obj.Dialog      = 0
  360.     Obj.AttrDlg     = 0
  361.     Obj.Parent      = Parent                ; Set true parent ptr
  362.     Obj2Ptr, Obj, Ptr                       ; Store into pointer
  363.  
  364.     ;   Restore children
  365.     WHILE 1 DO BEGIN
  366.         Type    = ""
  367.         READU, Unit, Type                   ; Get the Type
  368.         IF Type EQ "_END_" THEN RETURN      ; End-Of-List Marker?
  369.  
  370.         ClearVar, Child
  371.         CALL_PROCEDURE, Type+"_Restore", Unit, Ptr, Child    ; Get Child
  372.         AddChild, Ptr, Child, /NO_UPDATE, /NO_CANCEL
  373.     ENDWHILE
  374. END
  375.  
  376. ;
  377. ;  BASE_Restore
  378. ;   Read in a base object (and its children) from a file
  379. ;
  380. PRO BASE_Restore, Unit, Parent, Ptr
  381.     urBASE_Restore, Unit, Parent, Ptr, "BASE"
  382. END
  383.  
  384. ;
  385. ;   BASE_BuildAttr
  386. ;       Object contains information about the base.  Ptr is needed
  387. ;   for object naming.  Routine builds the 'extra' dialog box that
  388. ;   base objects have.
  389. ;
  390. PRO BASE_BuildAttr, Leader, Ptr, Obj
  391.  
  392.     MgrName = 'WidBAttr' + STRTRIM(Ptr,2)       ; Addition Attr Dialog exists?
  393.     IF XRegistered(MgrName) THEN RETURN
  394.  
  395.     ;   Create one.
  396.  
  397.     Foci    = LONARR(7)
  398.     Title   = 'BASE ' + STRTRIM(Obj.Id,2) + ' Attributes'
  399.     Base    = WIDGET_BASE(  GROUP_LEADER=Leader, /COLUMN, TITLE=Title)
  400.  
  401.     ;   Event Related Info
  402.  
  403.     Base1   = WIDGET_BASE(Base, /FRAME, /COLUMN)
  404.     Lab     = WIDGET_LABEL(Base1, VALUE="Event Controls")
  405.  
  406.     Foci[0] = Field(Base1, "Function Name for GET_VALUE:", Obj.GetFunc, $
  407.                 "GETFUNC", SIZE=20, /STRING)
  408.     Foci[1] = Field(Base1, "Procedure Name for SET_VALUE:", Obj.SetProc, $
  409.                 "SETPROC", SIZE=20, /STRING)
  410.     Foci[2] = Field(Base1, "Procedure Name for KILL_NOTIFY:", Obj.KillProc, $
  411.                 "KILLPROC", SIZE=20, /STRING)
  412.  
  413.     Base1   = WIDGET_BASE(Base, /FRAME, /COLUMN)
  414.     Lab     = WIDGET_LABEL(Base1, VALUE="Window Appearance Controls")
  415.     BuildXY, Base1, Obj, Foci, 3, /SCROLL, /OFFSET
  416.     Base2   = WIDGET_BASE(Base1, /NONEXCLUSIVE, /ROW)
  417.     Btn     = WIDGET_BUTTON(Base2,              $
  418.                 VALUE='Base Starts Mapped', $
  419.                 UVALUE='MAPPED')
  420.     IF Obj.BaseMapped EQ 1 THEN WIDGET_CONTROL, Btn, /SET_BUTTON
  421.     Dummy   = WIDGET_LABEL(Base, VALUE=' ')
  422.     Dummy   = WIDGET_BUTTON(Base, VALUE='Done', UVALUE='DONE')
  423.  
  424.     DlgInfo     = {         $
  425.         Foci:       Foci,   $
  426.         ObjPtr:     Ptr     $
  427.     }
  428.     Obj.AttrDlg = Base
  429.     WIDGET_CONTROL, Base, SET_UVALUE=DlgInfo, /NO_COPY
  430.     WIDGET_CONTROL, Base, /REALIZE
  431.     XMANAGER, MgrName, Base, EVENT_HANDLER='BASE_Event', CLEANUP='DEP_Kill'
  432. END
  433.  
  434.  
  435. ;
  436. ;  BASE_Generate
  437. ;       Create a base object and its children for previewing.
  438. ;
  439. PRO BASE_Generate, Base, Ptr
  440.  
  441.   COMMON WidEd_Comm
  442.  
  443.     Ptr2Obj, Ptr, Obj
  444.  
  445.     Id  = 0L            ; Prevent EXECUTE from creating a new variable
  446.  
  447.     ;   Generate command string
  448.  
  449.     Cmd = 'Id = WIDGET_BASE(Base'
  450.     Cmd = Cmd + ",/TLB_SIZE_EVENTS"
  451.     SAddCmd, Cmd, Obj.Name, 'TITLE'
  452.     IAddCmd, Cmd, Obj.FrameSize, 'FRAME'
  453.     IAddCmd, Cmd, Obj.XSize, 'XSIZE'
  454.     IAddCmd, Cmd, Obj.YSize, 'YSIZE'
  455.     IAddCmd, Cmd, Obj.XOffset, 'XOFFSET'
  456.     IAddCmd, Cmd, Obj.YOffset, 'YOFFSET'
  457.     IAddCmd, Cmd, Obj.XScrollSize, 'X_SCROLL_SIZE'
  458.     IAddCmd, Cmd, Obj.YScrollSize, 'Y_SCROLL_SIZE'
  459.  
  460.     ;   Row/Column?
  461.  
  462.     IF Obj.BaseType EQ 1 THEN           $
  463.         IAddCmd, Cmd, Obj.NRowCol, 'ROW'    $
  464.     ELSE IF Obj.BaseType EQ 2 THEN      $
  465.         IAddCmd, Cmd, Obj.NRowCol, 'COLUMN'
  466.  
  467.     IAddCmd, Cmd, Obj.Space, 'SPACE'
  468.     IAddCmd, Cmd, Obj.XPad, 'XPAD'
  469.     IAddCmd, Cmd, Obj.YPad, 'YPAD'
  470.  
  471.     ; Create base by running command string we just built
  472.  
  473.     IF EXECUTE(Cmd+')') NE 1 THEN BEGIN
  474.         Obj2Ptr, Obj, Ptr
  475.         MESSAGE,'Could not build base' + VarName[Ptr]
  476.     ENDIF
  477.  
  478.     ; Create any child widgets
  479.  
  480.     Child   = Obj.Children
  481.     WHILE Child NE 0L DO BEGIN
  482.         GetType, Child, Type
  483.         CALL_PROCEDURE, Type + "_Generate", Id, Child
  484.         Child   = NextPtr(Child)
  485.     ENDWHILE
  486.  
  487.     Obj2Ptr, Obj, Ptr
  488. END
  489.  
  490. ;
  491. ;  urBase_GenWid
  492. ;   Create code for generating any base class widget and children
  493. ;
  494. PRO urBase_GenWid, Unit, Ptr, Obj, Name
  495.  
  496.     ;   Create base information
  497.  
  498.     ;   Row/Column Base?
  499.  
  500.     IF Obj.BaseType EQ 1 THEN           $
  501.         ISaveCmd, Unit, Obj.NRowCol, 'ROW'  $
  502.     ELSE IF Obj.BaseType EQ 2 THEN  $
  503.         ISaveCmd, Unit, Obj.NRowCol, 'COLUMN'
  504.  
  505.     ISaveCmd, Unit, Obj.Space, 'SPACE'
  506.     ISaveCmd, Unit, Obj.XPad, 'XPAD'
  507.     ISaveCmd, Unit, Obj.YPad, 'YPAD'
  508. ;    SSaveCmd, Unit, Obj.EventFunc, "EVENT_FUNC"
  509. ;    SSaveCmd, Unit, Obj.EventProc, "EVENT_PROC"
  510.     ISaveCmd, Unit, Obj.FrameSize, "FRAME"
  511.     SSaveCmd, Unit, Obj.GetFunc, "FUNC_GET_VALUE"
  512.     SSaveCmd, Unit, Obj.KillProc, "KILL_NOTIFY"
  513.     ISaveCmd, Unit, Obj.BaseMapped, "MAP", /FORCE
  514.     SSaveCmd, Unit, Obj.SetProc, "PRO_SET_VALUE"
  515.     SSaveCmd, Unit, Obj.Name, "TITLE"
  516.     ISaveCmd, Unit, Obj.TLBEvents, "TLB_SIZE_EVENTS"
  517.     SSaveCmd, Unit, UValue(Obj, Ptr), "UVALUE"
  518.     ISaveCmd, Unit, Obj.XOffset, "XOFFSET"
  519.     ISaveCmd, Unit, Obj.XSize, "XSIZE"
  520.     ISaveCmd, Unit, Obj.XScrollSize, "X_SCROLL_SIZE"
  521.     ISaveCmd, Unit, Obj.YOffset, "YOFFSET"
  522.     ISaveCmd, Unit, Obj.YSize, "YSIZE"
  523.     ISaveCmd, Unit, Obj.YScrollSize, "Y_SCROLL_SIZE"
  524.  
  525.     XPRINTF, Unit, ')'
  526.     XPRINTF, Unit
  527.  
  528.     ;   Now generate code for creating children objects.
  529.  
  530.     Child   = Obj.Children
  531.     WHILE Child NE 0 DO BEGIN
  532.         GetType, Child, Type
  533.         CALL_PROCEDURE, Type+"_GenWid", Unit, Child, Name
  534.         Child   = NextPtr(Child)
  535.  
  536.         XPRINTF, Unit    ; Put a blank line between each child
  537.     ENDWHILE
  538. END
  539.  
  540. ;
  541. ;  BASE_GenWid
  542. ;   Generate IDL code for creating a BASE widget
  543. ;
  544. PRO BASE_GenWid, Unit, Ptr, Parent
  545.     Name    = VarId(Ptr)
  546.     Ptr2Obj, Ptr, Obj
  547.     XPRINTF, Unit, FORMAT='("  ",A," = WIDGET_BASE(",A)', Name, Parent,/NO_EOL
  548.     urBase_GenWid, Unit, Ptr, Obj, Name
  549.     Obj2Ptr, Obj, Ptr
  550. END
  551.  
  552.  
  553. ;
  554. ;  BASE_Alloc
  555. ;       Allocate a base object (if Ptr is NULL or just invalid)
  556. ;   There are 3 base object classes (MAIN,DEP, and BASE) so they call
  557. ;   a common routine to allocate base objects.
  558. ;
  559. PRO BASE_Alloc, Parent, Ptr
  560.   COMMON WidEd_Comm
  561.  
  562.     IF KEYWORD_SET(Ptr) NE 0 THEN RETURN    ; Ptr already allocated
  563.  
  564.     Ptr = WIDGET_BASE(GROUP=TopDlg)         ; Make a pointer
  565.     MakeBaseObj, Parent, Obj, "BASE"        ; Make a base object
  566.     Obj2Ptr, Obj, Ptr                       ; Store object in pointer
  567. END
  568.